package cn.wsw;

import cn.wsw.hrm.UserApp_9004;
import cn.wsw.hrm.client.RedisClient;
import cn.wsw.hrm.client.TRedisClient;
import cn.wsw.hrm.service.ImageValidateCodeService;
import cn.wsw.hrm.util.AjaxResult;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.UUID;

@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = UserApp_9004.class)
public class Maintest {
    @Autowired
    private ImageValidateCodeService imageValidateCodeService;
    @Autowired
    private RedisClient redisClient;
    @Autowired
    private TRedisClient tRedisClient;

    @Test
    public void name() {
        UUID uuid = UUID.randomUUID();
        String s = uuid.toString().substring(0, 4);
        String less = imageValidateCodeService.getCode(s);
        System.out.println(less);
    }

    @Test
    public void test1() {
        try {
            redisClient.addForTime("name","shier",60*5);
            System.out.println("qqqqqqqqqqqqqqqqqqqqq");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    @Test
    public void test3() {
        try {
            redisClient.add("grede","qeqwer");
            System.out.println("qqqqqqqqqqqqqqqqqqqqq");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    @Test
    public void test2() {
        try {
            System.out.println(redisClient.get("grede"));
            System.out.println("qqqqqqqqqqqqqqqqqqqqq");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

     
}
